return new_context;
}
-static GdkWindow *
-gdk_broadway_drag_context_find_window (GdkDragContext *context,
- GdkWindow *drag_window,
- gint x_root,
- gint y_root,
- GdkDragProtocol *protocol)
-{
- g_return_val_if_fail (context != NULL, NULL);
- return NULL;
-}
-
-static gboolean
-gdk_broadway_drag_context_drag_motion (GdkDragContext *context,
- GdkWindow *dest_window,
- GdkDragProtocol protocol,
- gint x_root,
- gint y_root,
- GdkDragAction suggested_action,
- GdkDragAction possible_actions,
- guint32 time)
-{
- g_return_val_if_fail (context != NULL, FALSE);
- g_return_val_if_fail (dest_window == NULL || GDK_WINDOW_IS_BROADWAY (dest_window), FALSE);
-
- return FALSE;
-}
-
static void
gdk_broadway_drag_context_drag_drop (GdkDragContext *context,
guint32 time)
object_class->finalize = gdk_broadway_drag_context_finalize;
- context_class->find_window = gdk_broadway_drag_context_find_window;
context_class->drag_status = gdk_broadway_drag_context_drag_status;
- context_class->drag_motion = gdk_broadway_drag_context_drag_motion;
context_class->drag_abort = gdk_broadway_drag_context_drag_abort;
context_class->drag_drop = gdk_broadway_drag_context_drag_drop;
context_class->drop_reply = gdk_broadway_drag_context_drop_reply;
g_object_class_install_properties (object_class, N_PROPERTIES, properties);
}
-/*
- * gdk_drag_find_window:
- * @context: a #GdkDragContext
- * @drag_window: a window which may be at the pointer position, but
- * should be ignored, since it is put up by the drag source as an icon
- * @x_root: the x position of the pointer in root coordinates
- * @y_root: the y position of the pointer in root coordinates
- * @dest_window: (out): location to store the destination window in
- * @protocol: (out): location to store the DND protocol in
- *
- * Finds the destination window and DND protocol to use at the
- * given pointer position.
- *
- * This function is called by the drag source to obtain the
- * @dest_window and @protocol parameters for gdk_drag_motion().
- *
- * Since: 2.2
- */
-void
-gdk_drag_find_window (GdkDragContext *context,
- GdkWindow *drag_window,
- gint x_root,
- gint y_root,
- GdkWindow **dest_window,
- GdkDragProtocol *protocol)
-{
- g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
-
- *dest_window = GDK_DRAG_CONTEXT_GET_CLASS (context)
- ->find_window (context, drag_window, x_root, y_root, protocol);
-}
-
/**
* gdk_drag_status:
* @context: a #GdkDragContext
GDK_DRAG_CONTEXT_GET_CLASS (context)->drag_status (context, action, time_);
}
-/*
- * gdk_drag_motion:
- * @context: a #GdkDragContext
- * @dest_window: the new destination window, obtained by
- * gdk_drag_find_window()
- * @protocol: the DND protocol in use, obtained by gdk_drag_find_window()
- * @x_root: the x position of the pointer in root coordinates
- * @y_root: the y position of the pointer in root coordinates
- * @suggested_action: the suggested action
- * @possible_actions: the possible actions
- * @time_: the timestamp for this operation
- *
- * Updates the drag context when the pointer moves or the
- * set of actions changes.
- *
- * This function is called by the drag source.
- *
- * Returns:
- */
-gboolean
-gdk_drag_motion (GdkDragContext *context,
- GdkWindow *dest_window,
- GdkDragProtocol protocol,
- gint x_root,
- gint y_root,
- GdkDragAction suggested_action,
- GdkDragAction possible_actions,
- guint32 time_)
-{
- g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), FALSE);
-
- return GDK_DRAG_CONTEXT_GET_CLASS (context)
- ->drag_motion (context,
- dest_window,
- protocol,
- x_root,
- y_root,
- suggested_action,
- possible_actions,
- time_);
-}
-
/*
* gdk_drag_abort:
* @context: a #GdkDragContext
struct _GdkDragContextClass {
GObjectClass parent_class;
- GdkWindow * (*find_window) (GdkDragContext *context,
- GdkWindow *drag_window,
- gint x_root,
- gint y_root,
- GdkDragProtocol *protocol);
- gboolean (*drag_motion) (GdkDragContext *context,
- GdkWindow *dest_window,
- GdkDragProtocol protocol,
- gint root_x,
- gint root_y,
- GdkDragAction suggested_action,
- GdkDragAction possible_actions,
- guint32 time_);
void (*drag_status) (GdkDragContext *context,
GdkDragAction action,
guint32 time_);
GdkCursor * gdk_drag_get_cursor (GdkDragContext *context,
GdkDragAction action);
-gboolean gdk_drag_motion (GdkDragContext *context,
- GdkWindow *dest_window,
- GdkDragProtocol protocol,
- gint x_root,
- gint y_root,
- GdkDragAction suggested_action,
- GdkDragAction possible_actions,
- guint32 time_);
void gdk_drag_abort (GdkDragContext *context,
guint32 time_);
void gdk_drag_drop (GdkDragContext *context,
guint32 time_);
-void gdk_drag_find_window (GdkDragContext *context,
- GdkWindow *drag_window,
- gint x_root,
- gint y_root,
- GdkWindow **dest_window,
- GdkDragProtocol *protocol);
-
void gdk_drag_context_write_async (GdkDragContext *context,
const char *mime_type,
GOutputStream *stream,
return _gdk_quartz_drag_source_context;
}
-static gboolean
-gdk_quartz_drag_context_drag_motion (GdkDragContext *context,
- GdkWindow *dest_window,
- GdkDragProtocol protocol,
- gint x_root,
- gint y_root,
- GdkDragAction suggested_action,
- GdkDragAction possible_actions,
- guint32 time)
-{
- /* FIXME: Implement */
- return FALSE;
-}
-
-static GdkWindow *
-gdk_quartz_drag_context_find_window (GdkDragContext *context,
- GdkWindow *drag_window,
- gint x_root,
- gint y_root,
- GdkDragProtocol *protocol)
-{
- /* FIXME: Implement */
- return NULL;
-}
-
static void
gdk_quartz_drag_context_drag_drop (GdkDragContext *context,
guint32 time)
object_class->finalize = gdk_quartz_drag_context_finalize;
- context_class->find_window = gdk_quartz_drag_context_find_window;
context_class->drag_status = gdk_quartz_drag_context_drag_status;
- context_class->drag_motion = gdk_quartz_drag_context_drag_motion;
context_class->drag_abort = gdk_quartz_drag_context_drag_abort;
context_class->drag_drop = gdk_quartz_drag_context_drag_drop;
context_class->drop_reply = gdk_quartz_drag_context_drop_reply;
g_object_unref (event);
}
-static GdkWindow *
-gdk_wayland_drag_context_find_window (GdkDragContext *context,
- GdkWindow *drag_window,
- gint x_root,
- gint y_root,
- GdkDragProtocol *protocol)
-{
- GdkDevice *device;
- GdkWindow *window;
-
- device = gdk_drag_context_get_device (context);
- window = gdk_device_get_window_at_position (device, NULL, NULL);
-
- if (window)
- {
- window = gdk_window_get_toplevel (window);
- *protocol = GDK_DRAG_PROTO_WAYLAND;
- return g_object_ref (window);
- }
-
- return NULL;
-}
-
static inline uint32_t
gdk_to_wl_actions (GdkDragAction action)
{
context->suggested_action = context->action = action;
}
-static gboolean
-gdk_wayland_drag_context_drag_motion (GdkDragContext *context,
- GdkWindow *dest_window,
- GdkDragProtocol protocol,
- gint x_root,
- gint y_root,
- GdkDragAction suggested_action,
- GdkDragAction possible_actions,
- guint32 time)
-{
- if (context->dest_window != dest_window)
- {
- context->dest_window = dest_window ? g_object_ref (dest_window) : NULL;
- _gdk_wayland_drag_context_set_coords (context, x_root, y_root);
- }
-
- gdk_wayland_drag_context_set_action (context, suggested_action);
-
- return context->dest_window != NULL;
-}
-
static void
gdk_wayland_drag_context_drag_abort (GdkDragContext *context,
guint32 time)
object_class->finalize = gdk_wayland_drag_context_finalize;
- context_class->find_window = gdk_wayland_drag_context_find_window;
context_class->drag_status = gdk_wayland_drag_context_drag_status;
- context_class->drag_motion = gdk_wayland_drag_context_drag_motion;
context_class->drag_abort = gdk_wayland_drag_context_drag_abort;
context_class->drag_drop = gdk_wayland_drag_context_drag_drop;
context_class->drop_reply = gdk_wayland_drag_context_drop_reply;
object_class->finalize = gdk_x11_drag_context_finalize;
- context_class->find_window = gdk_x11_drag_context_find_window;
context_class->drag_status = gdk_x11_drag_context_drag_status;
- context_class->drag_motion = gdk_x11_drag_context_drag_motion;
context_class->drag_abort = gdk_x11_drag_context_drag_abort;
context_class->drag_drop = gdk_x11_drag_context_drag_drop;
context_class->drop_reply = gdk_x11_drag_context_drop_reply;
* the XDND protocol version, and in particular doesn't know
* that gdk_drag_find_window() has the side-effect
* of setting context_x11->version, and therefore sometimes call
- * gdk_drag_motion() without a prior call to
+ * gdk_x11_drag_context_drag_motion() without a prior call to
* gdk_drag_find_window(). This happens, e.g.
* when GTK+ is proxying DND events to embedded windows.
*/
case GDK_DRAG_PROTO_LOCAL:
case GDK_DRAG_PROTO_WAYLAND:
case GDK_DRAG_PROTO_NONE:
- g_warning ("Invalid drag protocol %u in gdk_drag_motion()", context->protocol);
+ g_warning ("Invalid drag protocol %u in gdk_x11_drag_context_drag_motion()", context->protocol);
break;
default:
break;
gdk_drag_get_current_actions (mods, GDK_BUTTON_PRIMARY, x11_context->actions,
&action, &possible_actions);
- gdk_drag_find_window (context,
- x11_context->drag_window,
- x_root, y_root, &dest_window, &protocol);
+ dest_window = gdk_x11_drag_context_find_window (context,
+ x11_context->drag_window,
+ x_root, y_root, &protocol);
- gdk_drag_motion (context, dest_window, protocol, x_root, y_root,
- action, possible_actions, evtime);
+ gdk_x11_drag_context_drag_motion (context, dest_window, protocol, x_root, y_root,
+ action, possible_actions, evtime);
}
static gboolean